from fastapi import APIRouter, Security

from app.api.v1.endpoints import (
    api,
    login_log,
    menu,
    auth,
    operation_log,
    file,
    user,
    region,
    dict,
    role,
    dict_type, device,websocket
)
from app.deps.authorize_deps import get_current_user

openapi_tags = [
    {"name": "auth", "description": "权限"},
    {"name": "user", "description": "用户"},
    {"name": "role", "description": "角色"},
    {"name": "menu", "description": "菜单"},
    {"name": "region", "description": "地区"},
    {"name": "device", "description": "设备"},
    {"name": "file", "description": "文件"},
    {"name": "dict", "description": "字典"},
    {"name": "dict_type", "description": "字典类型"},
    {"name": "login_log", "description": "登录日志"},
    {"name": "operation_log", "description": "操作日志"},
    {"name": "api", "description": "接口"},
    # {"name": "websocket", "description": "WebSocket"},
]


common_router = APIRouter()
permission_router = APIRouter(dependencies=[Security(get_current_user, scopes=["admin"])])

common_router.include_router(auth.auth_router, prefix="/auth", tags=["auth"])
common_router.include_router(websocket.websocket_router, prefix="/websocket", tags=["websocket"])

permission_router.include_router(user.user_router, prefix="/user", tags=["user"])
permission_router.include_router(role.role_router, prefix="/role", tags=["role"])
permission_router.include_router(menu.menu_router, prefix="/menu", tags=["menu"])
permission_router.include_router(region.region_router, prefix="/region", tags=["region"])
permission_router.include_router(device.device_router, prefix="/device", tags=["device"])
permission_router.include_router(file.file_router, prefix="/file", tags=["file"])
permission_router.include_router(login_log.login_log_router, prefix="/login_log", tags=["login_log"])
permission_router.include_router(operation_log.operation_log_router, prefix="/operation_log", tags=["operation_log"])
permission_router.include_router(dict.dict_router, prefix="/dict", tags=["dict"])
permission_router.include_router(dict_type.dict_type_router, prefix="/dict_type", tags=["dict_type"])
permission_router.include_router(api.api_router, prefix="/api", tags=["api"])



router = APIRouter(prefix="/api/v1")

router.include_router(common_router)
router.include_router(permission_router)